import os
from drose_dataset.generate_video import cut_video_by_video
import math


def generate_dataset(input_path, generate_output_path):
    """

    :param generate_output_path:
    :param input_path:  目录
    :return:
    """
    for root_root, root_dirs, root_files in os.walk(input_path):
        for dir_name in root_dirs:
            for c_root, c_dirs, c_files in os.walk(os.path.join(root_root, dir_name)):
                # 获取文件路径
                print(dir_name)
                for file in c_files:
                    cut_video_by_video(c_root, file)


if __name__ == "__main__":
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\01', "0.mov", [100, 900, 100, 100], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\01', "10.MOV", [400, 850, 200, 100], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\01', "5.mov", [100, 900, 100, 100], 0)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\02', "0.mov", [100, 900, 100, 100], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\02', "10.MOV", [100, 900, 100, 100], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\02', "5.MOV", [100, 900, 100, 100], 3)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\03', "0.MOV", [200, 700, 200, 100], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\03', "10.mov", [100, 100, 300, 200], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\03', "5.mov", [100, 100, 300, 200], 0)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\04', "0.mp4", [0, 0, 200, 0], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\04', "10.mp4", [0, 400, 0, 0], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\04', "5.mp4", [0, 200, 400, 100], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\05', "0.MOV", [100, 300, 0, 0], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\05', "10.MOV", [100, 300, 0, 0], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\05', "5.MOV", [100, 300, 0, 0], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\06', "0.mp4", [100, 400, 400, 300], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\06', "10.mp4", [100, 300, 600, 300], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part1\06', "5.mp4", [100, 300, 600, 300], 0)
    # # -------------------------------------------------------------------------------------------------------------------
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\07', "0.mp4", [100, 800, 80, 80], 1)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\07', "10.mp4", [100, 700, 100, 50], 1)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\07', "5.mp4", [0, 500, 500, 600], 0)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\08', "0.mp4", [50, 350, 50, 150], 1)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\08', "10.mp4", [300, 900, 300, 200], 1)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\08', "5.mp4", [100, 800, 100, 100], 1)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\09', "0.mp4", [200, 1000, 100, 100], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\09', "10.mp4", [300, 800, 100, 100], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\09', "5.mp4", [0,1000, 100, 100], 0)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\10', "0.MOV", [0, 150, 0, 50], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\10', "10.MOV", [100, 300, 0, 200], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\10', "5.MOV", [350, 300, 50, 100], 3)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\11', "0.mp4", [0, 200, 350, 350], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\11', "10.mp4", [50, 100, 350, 350], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\11', "5.mp4", [50, 100, 350, 350], 0)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\12', "0.mp4", [0, 350, 350, 350], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\12', "10.mp4", [100, 200, 350, 350], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold1_part2\12', "5.mp4", [0, 200, 400, 100], 0)

    # ------------------------------------------------------------------------------------------------------------------

    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\13', "0.mp4", [100, 1000, 200, 200], 1)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\13', "10.mp4", [200, 400, 100, 100], 1)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\13', "5.mp4", [100, 700, 200, 200], 1)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\14', "0.mp4", [0, 1100, 100, 100], 1)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\14', "10.mp4", [0, 300, 600, 600], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\14', "5.mp4", [0, 100, 300, 250], 0)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\15', "0.mp4", [0, 200, 200, 200], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\15', "10.mp4", [0, 200, 300, 300], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\15', "5.mp4", [50, 200, 300, 300], 0)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\16', "0.MOV", [100, 500, 0, 200], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\16', "10.MOV", [100, 300, 0, 200], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\16', "5.MOV", [100, 500, 0, 200], 0)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\17', "0.mp4", [100, 200, 100, 100], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\17', "10.mp4", [50, 100, 0, 0], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\17', "5.mp4", [300, 500, 100, 100], 0)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\18', "0.mov", [0, 200, 100, 100], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\18', "10.mov", [0, 200, 100, 100], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part1\18', "5.mov", [0, 200, 100, 100], 0)
    #
    # # ------------------------------------------------------------------------------------------------------------------
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\19', "0.MOV", [100, 500, 200, 0], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\19', "10.MOV", [100, 600, 200, 0], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\19', "5.MOV", [100, 800, 200, 0], 3)
    #
    cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\20', "0.mp4", [0, 200, 500, 0], 0)
    cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\20', "10.mp4", [150, 250, 150, 0], 1)
    cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\20', "5.MOV", [0, 0, 250, 0], 0)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\21', "0.MOV", [100, 500, 0, 0], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\21', "10.MOV", [100, 500, 0, 0], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\21', "5.MOV", [100, 600, 0, 0], 3)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\22', "0.MOV",  [200, 600, 200, 200], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\22', "10.MOV", [200, 600, 200, 200], 3)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\22', "5.MOV",  [200, 600, 200, 200], 3)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\23', "0.mp4",  [200, 200, 500, 500], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\23', "10.mp4", [200, 200, 500, 450], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\23', "5.mp4",  [200, 300, 500, 450], 0)
    #
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\24', "0.mp4",  [100, 150, 300, 350], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\24', "10.mp4", [100, 150, 300, 300], 0)
    # cut_video_by_video(r'E:\dataset\UTA-RLDD\Fold2_part2\24', "5.mp4",  [100, 150, 300, 300], 0)

    # ------------------------------------------------------------------------------------------------------------------
    # cut_video_by_video(r'D:\dataset\Fold3_part1\25', "0.mp4", [150, 350, 100, 100], 1)
    # cut_video_by_video(r'D:\dataset\Fold3_part1\25', "5.mp4", [350, 650, 150, 150], 1)
    # cut_video_by_video(r'D:\dataset\Fold3_part1\25', "10.mp4", [400, 600, 300, 100], 1)
    #
    # cut_video_by_video(r'D:\dataset\Fold3_part1\26', "0.mp4", [200, 300, 800, 700])
    # cut_video_by_video(r'D:\dataset\Fold3_part1\26', "5.mp4", [0, 400, 0, 800], 2)
    # cut_video_by_video(r'D:\dataset\Fold3_part1\26', "10.mp4", [100, 400, 100, 200], 1)
    #
    # cut_video_by_video(r'D:\dataset\Fold3_part1\27', "0.MOV", [400, 200, 100, 100], 0)
    # cut_video_by_video(r'D:\dataset\Fold3_part1\27', "10.MOV", [100, 300, 200, 0], 0)
    # cut_video_by_video(r'D:\dataset\Fold3_part1\27', "5.MOV", [0, 600, 0, 0], 0)
    #
    # cut_video_by_video(r'D:\dataset\Fold3_part1\28', "0.MOV", [0, 200, 50, 50], 3)
    # cut_video_by_video(r'D:\dataset\Fold3_part1\28', "10.MOV", [200, 200, 100, 100], 3)
    # cut_video_by_video(r'D:\dataset\Fold3_part1\28', "5.MOV", [250, 200, 100, 100], 3)
    #
    # cut_video_by_video(r'D:\dataset\Fold3_part1\29', "0.mp4", [0, 200, 100, 100], 0)
    # cut_video_by_video(r'D:\dataset\Fold3_part1\29', "10.mp4", [0, 200, 100, 100], 0)
    # cut_video_by_video(r'D:\dataset\Fold3_part1\29', "5.mp4", [0, 200, 100, 100], 0)
    #
    # cut_video_by_video(r'D:\dataset\Fold3_part1\30', "0.mp4", [100, 500, 100, 100], 0)
    # cut_video_by_video(r'D:\dataset\Fold3_part1\30', "10.mp4", [100, 300, 0, 200], 1)
    # cut_video_by_video(r'D:\dataset\Fold3_part1\30', "5.mp4", [200, 400, 0, 200], 0)
    # ------------------------------------------------------------------------------------------------------------------
    # cut_video_by_video(r"D:\dataset\Fold3_part2\31", "0.mp4",[0, 800, 0, 300])
    # cut_video_by_video(r"D:\dataset\Fold3_part2\31", "5.mp4",[50, 750, 150, 150])
    # cut_video_by_video(r"D:\dataset\Fold3_part2\31", "10.mp4",[200, 600, 50, 250])
    #
    # cut_video_by_video(r"D:\dataset\Fold3_part2\32", "0.mp4",[250, 750, 300, 150])
    # cut_video_by_video(r"D:\dataset\Fold3_part2\32", "5.mp4",[300, 500, 300, 200])
    # cut_video_by_video(r"D:\dataset\Fold3_part2\32", "10_1.mp4",[200, 200, 100, 100])
    # cut_video_by_video(r"D:\dataset\Fold3_part2\32", "10_2.mp4",[100, 150, 50, 0], start=200)
    #
    # cut_video_by_video(r"D:\dataset\Fold3_part2\33", "0.mp4",[0, 200, 50, 50], 1)
    # cut_video_by_video(r"D:\dataset\Fold3_part2\33", "5.mp4",[0, 200, 50, 50], 1)
    # cut_video_by_video(r"D:\dataset\Fold3_part2\33", "10.mp4",[0, 200, 50, 50], 1)

    # cut_video_by_video(r"D:\dataset\Fold3_part2\34", "0.mov",[0, 200, 200, 200])
    # cut_video_by_video(r"D:\dataset\Fold3_part2\34", "5.mov",[0, 200, 300, 300])
    # cut_video_by_video(r"D:\dataset\Fold3_part2\34", "10.mp4",[100, 180, 250, 270])
    #
    # cut_video_by_video(r"D:\dataset\Fold3_part2\35", "0.mp4",[0, 700, 0, 0])
    # cut_video_by_video(r"D:\dataset\Fold3_part2\35", "5.mp4",[0, 700, 0, 0])
    # cut_video_by_video(r"D:\dataset\Fold3_part2\35", "10.mp4",[0, 800, 0, 0])
    #
    # cut_video_by_video(r"D:\dataset\Fold3_part2\36", "0.mp4",[150, 150, 400, 400])
    # cut_video_by_video(r"D:\dataset\Fold3_part2\36", "5.mp4",[100, 200, 400, 450])
    # cut_video_by_video(r"D:\dataset\Fold3_part2\36", "10.mp4",[80, 130, 350, 420])
